import { http } from './index'

/**
 * 分页查询
 * @param {Object} params
 */
export function getGroupPageList (params) {
  return http.post('/system/SysGroups/page', params)
}

export function getCurrentUserUnitGroupAndLines () {
  return http.get('/system/SysGroups/getCurrentUserUnitGroupAndLines')
}

export function getparentUnits (params) {
  return http.post('/system/SysUnitinfo/getParentUnits', params)
}

/**
 * 返回分组信息
 * @param {*} params
 * @returns
 */
export function getGroupList (params) {
  return http.post('/system/SysGroups/groupsList', params)
}

/**
 * 根据分组ID查询分组详情
 * @param {*} id   分组ID
 * @returns
 */
export function getGroupAndUnitsById (groupId) {
  return http.get(`/system/SysGroups/select/${groupId}`)
}

/**
 * 新增初始化
 * @returns
 */
export function init () {
  return http.post(`/system/SysGroups/init`)
}
/**
 * 新增、修改分组信息
 * @param {*} params
 * @returns
 */
export function saveOrUpdateGroupInfo (params) {
  return http.post('/system/SysGroups/save', params)
}

/**
 * 删除
 * @param {String} id
 */
export function deleteGroup (groupsId) {
  return http.get(`/system/SysGroups/del/${groupsId}`)
}

/**
 * 停用、启用
 * @param {String} id
 */
export function updateGroupStatus (groupsId) {
  return http.get(`/system/SysGroups/isEnable/${groupsId}`)
}